import win32gui
import pygetwindow


wins = pygetwindow.getWindowsWithTitle('微信')
print('**AutoWorker**', wins)
if len(wins) == 1:
    win = wins[0]
    win.activate()
    win32gui.SetForegroundWindow(win._hWnd)
    win32gui.SetActiveWindow(win._hWnd)
    win32gui.BringWindowToTop(win._hWnd)